<template>
  <avue-form v-model="formModel" ref="avueForm" :option="formOption"></avue-form>
</template>
<script>
import dataTableGenConfigOption from "@/views/start/development/table/dataTableGenConfigOption";
import {deepClone} from "utils/util";

export default {
  name: "editTableGenCode",
  props: {
    modelValue: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  watch: {},
  computed: {
    formOption() {
      return dataTableGenConfigOption()
    },
  },
  data() {
    return {
      formModel: {}
    }
  },
  created() {
    this.formModel = deepClone(this.modelValue)
  },
  methods: {
    validate() {
      return new Promise((resolve, reject) => {
        this.$refs.avueForm.validate((valid, done, err) => {
          if (valid) {
            resolve(deepClone(this.formModel))
            return
          }
          reject(err)//注意这个地方是错误消息
        })
      })
    },
    restValidate() {
      this.$refs.avueForm.hide()
    }
  }
}
</script>
<style scoped>

</style>
